/**
 *
 * Description: 
 *
 * @author lirong
 * @version 1.0
 * <pre>
 * Modification History: 
 * Date         Author      Version     Description 
 * ------------------------------------------------------------------ 
 * 2012-3-15    lirong       1.0        1.0 Version 
 * </pre>
 */

package com.creditease.rss.ui;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.Window;
import android.webkit.WebView;
import android.widget.TextView;

/**
 * 
 * Description:
 * 
 * @author lirong
 * @version 1.0
 * 
 *          <pre>
 * Modification History: 
 * Date         Author      Version     Description 
 * ------------------------------------------------------------------ 
 * 2012-3-15    lirong       1.0        1.0 Version
 * </pre>
 */

public class RssReaderDetail extends Activity {
	private WebView webView;
	private float startX;
	private float endX;
	private TextView titleText;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);

		setContentView(R.layout.rss_reader_detail);
		getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title);

		webView = (WebView) findViewById(R.id.webView);
		webView.getSettings().setJavaScriptEnabled(true);
		// webView.setInitialScale(100);
		// 支持缩放
		webView.getSettings().setBuiltInZoomControls(true);
		// webView.getSettings()

		Intent intent = getIntent();
		String url = intent.getExtras().getString("url");
		String title = intent.getExtras().getString("title");
		// 标题
		titleText = (TextView) findViewById(R.id.titleText);
		titleText.setText(title);
		String urlString = "http://gate.baidu.com/tc?from=opentc&src=" + url;

		webView.getSettings().setDefaultTextEncodingName("UTF-8");
		// webView.loadData(buf.toString(), "text/html", "UTF-8");
		webView.loadUrl(urlString);

	}

	@Override
	public boolean onTouchEvent(MotionEvent event) {
		// 第一次按下事件
		if (event.getAction() == MotionEvent.ACTION_DOWN) {
			startX = event.getX();
		} else if (event.getAction() == MotionEvent.ACTION_UP) {
			endX = event.getX();
			// 从左往右
			if (startX < endX) {

			} else if (startX > endX) {

			}
		}

		return super.onTouchEvent(event);
	}

	/*
	 * public boolean onKeyDown(int keyCoder, KeyEvent event) { if
	 * (webView.canGoBack() && keyCoder == KeyEvent.KEYCODE_BACK) {
	 * webView.goBack(); // goBack()表示返回webView的上一页面 return true; } return
	 * false; }
	 */

	private final class MyJavaScript {

	}
}
